<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" /> 
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>鹏金所业务管理平台</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="${ctx}/css/login.css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/css/global.css"/>
    <script src="${ctx}/js/boot.js?v=1" type="text/javascript"></script>
    <script src="${ctx}/js/crypto-js/core.js"></script>
    <script src="${ctx}/js/crypto-js/md5.js"></script>
    <style>
    	.lh28{
    		line-height:28px;
    	}
		.warning{
			color:#FF0000;
		}
		.ui-form-item input{
			background-color:#fff;
		
		}
    </style>
</head>
<body >   
	<div class="login">
		<div class="mod-login">
			<div class="mod-login-header">
				<h3 class="title">鹏金所业务管理平台<i class="icon icon-topbg"></i></h3>
			</div>

			<div class="content">
				<div id="J_cnt_more">
					<div class="form-item-box1 J_tab_item" id="loginWindow">
						<form id="loginForm" action="${ctx}/acct/service/LoginService/login.do" method="post">
							<div class="ui-form-item">
								<label class="ui-label" for="username$text">用户</label>
								<input id="userid" name="userid" errorMode="none" onvalidation="onUserNameValidation" required="true" requiredErrorText="用户名不能为空" maxLength="20" vtype="minLength:2" minLengthErrorText="用户名不能少于2个字符" class="pass-input mini-textbox" />
								<p id="userId_error" class="errorText fn-left warning lh28"></p>
							</div>
							<div class="ui-form-item">
								<label class="ui-label" for="pwd$text">密码</label>
								<input id="pwd" name="pwd" errorMode="none" required="true"  vtype="minLength:2" minLengthErrorText="密码不能少于2个字符" requiredErrorText="密码不能为空" onvalidation="onPwdValidation"  onenter="onLoginClick" class="pass-input mini-password"/>
								<p id="password_error" class="errorText fn-left warning lh28"></p>
							</div>
							<div class="ui-form-item">
								<a class="btn login-btn" onclick="javascript:onLoginClick(event);">登录</a>
								<a class="btn reset-btn" onclick="javascript:onResetClick(event);">重置</a>
							</div>
						</form>
					</div>
				</div>
				
			</div>
			<div class="footer-s1">
		    	<span> © 2014～2016 鹏金所 All rights reserved | 深圳市鹏鼎创盈金融信息服务股份有限公司 | 粤ICP备:14056130号 </span>
		    </div>
    		
	</div>

    

    
    <script type="text/javascript">
        mini.parse();
        /* 
        var loginWindow = mini.get("loginWindow");
        loginWindow.show();
        
        if(top != window){
        	   top.location = "${ctx}/login"
        }   */
        
        function onLoginClick(e) {
          	var form = new mini.Form("#loginWindow");
            form.validate();
            if (form.isValid() == false) return; 
            //loginWindow.hide();
            mini.loading("登录验证中...", "登录验证");
            var forms =new mini.Form("#loginForm");
           	setCookie("userid",forms.getData().userId);
            setTimeout(function () {
            	var md5 = CryptoJS.MD5(forms.getData().pwd).toString();
            	var pwd=mini.get("pwd");
                pwd.setValue(md5);
            	$("#loginForm").submit();
            }, 1500);
        }
        function onResetClick(e) {
            var form = new mini.Form("#loginForm");
            form.clear();
        }
        /////////////////////////////////////
        function isEmail(s) {
            if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
                return true;
            else
                return false;
        }
        function updateState(e){
        	var id = e.sender.name + "_error";
            var el = document.getElementById(id);
            if (el) {
                el.innerHTML = e.errorText;
            }
        }
        function onUserNameValidation(e) {
            updateState(e);
        }
        function onPwdValidation(e) {
           	updateState(e);
        }
        var message = "${state.message}";
        if(message){
        	mini.showMessageBox({
                showModal: false,
                width: 250,
                title: "提示",
                iconCls: "mini-messagebox-warning",
                message: "登录名或密码错误",
                timeout: 3000,
                x: "center",
                y: "middle"
            });
        	$("#result").val("");
        	delCookie("userid");
        }

    </script>

</body>
</html>